home *** CD-ROM | disk | FTP | other *** search
/ Logiciels PC 7 / logiciel pc 7.iso / Linux / XFree86-3.3.3.1 / binaries / Linux-ix86-libc5 / preinst.sh < prev    next >
Linux/UNIX/POSIX Shell Script  |  1999-02-08  |  5KB  |  195 lines

  1. #!/bin/sh
  2.  
  3. # $XFree86: xc/programs/Xserver/hw/xfree86/etc/preinst.sh,v 3.8.2.6 1998/11/14 06:47:17 dawes Exp $
  4. #
  5. # preinst.sh  (for XFree86 3.3.3)
  6. #
  7. # This script should be run before installing a new version.
  8. #
  9. # It removes parts of an existing installation that can cause problems
  10. # when extracting the new version.  This includes symbolic links to old
  11. # beta versions, shared lib symlinks, and old files.
  12. #
  13. # $XConsortium: preinst.sh /main/5 1996/10/28 05:43:40 kaleb $
  14. #
  15.  
  16. RUNDIR=/usr/X11R6
  17.  
  18. #
  19. # Don't need this when using 'extract' to do the installation.
  20. #
  21. #LIBLIST=" \
  22. #    libICE.so \
  23. #    libPEX5.so \
  24. #    libSM.so \
  25. #    libX11.so \
  26. #    libXIE.so \
  27. #    libXaw.so \
  28. #    libXext.so \
  29. #    libXi.so \
  30. #    libXmu.so \
  31. #    libXp.so \
  32. #    libXt.so \
  33. #    libXtst.so \
  34. #    liboldX.so \
  35. #    libICE.so.6 \
  36. #    libPEX5.so.6 \
  37. #    libSM.so.6 \
  38. #    libX11.so.6 \
  39. #    libXIE.so.6 \
  40. #    libXaw.so.6 \
  41. #    libXext.so.6 \
  42. #    libXi.so.6 \
  43. #    libXmu.so.6 \
  44. #    libXp.so.6 \
  45. #    libXt.so.6 \
  46. #    libXtst.so.6 \
  47. #    liboldX.so.6 \
  48. #    "
  49.  
  50. OLDFILES=" \
  51.     lib/X11/doc/LbxproxyOnly \
  52.     lib/X11/xkb/keycodes/sgi \
  53.     lib/X11/xkb/symbols/de_nodead \
  54.     "
  55.  
  56. # First, do some checks for Linux/ELF
  57.  
  58. if [ "`uname`" = Linux ]; then
  59.     if file -L /bin/sh | grep ELF >/dev/null 2>&1; then
  60.         case "`arch`" in
  61.         i*86)
  62.         echo ""
  63.         if ldd /bin/sh | grep "libc.so.6" >/dev/null 2>&1; then
  64.             echo "You appear to have an glibc (libc-6) based system."
  65.             echo "Make sure you are installing the 'Linux-ix86-glibc' binary dist"
  66.         else
  67.             echo "You appear to have an ELF system."
  68.             echo "Make sure you are installing the 'Linux-ix86-libc5' binary dist"
  69.             echo "and *not* the 'Linux-ix86-glibc' binary dist"
  70.         fi
  71.         ;;
  72.         esac
  73.         # Check ldconfig
  74.         LDSO=`/sbin/ldconfig -v -n | awk '{ print $3 }'`
  75.         LDSOMIN=`echo $LDSO | awk -F. '{ print $3 }'`
  76.         LDSOMID=`echo $LDSO | awk -F. '{ print $2 }'`
  77.         LDSOMAJ=`echo $LDSO | awk -F. '{ print $1 }'`
  78.         if [ "$LDSOMAJ" -gt 1 ]; then
  79.             : OK
  80.         else
  81.             if [ "$LDSOMID" -gt 7 ]; then
  82.                 : OK
  83.             else
  84.             if [ "$LDSOMIN" -ge 14 ]; then
  85.             : OK
  86.             else
  87.                 echo ""
  88.                 echo "Before continuing you will need to get a current version of ld.so."
  89.                 echo "Version 1.7.14 or newer will do."
  90.                 NEEDSOMETHING=YES
  91.             fi
  92.         fi
  93.         fi
  94.     else
  95.         case "`arch`" in
  96.         i*86)
  97.         echo ""
  98.         echo "You appear to have an a.out system."
  99.         echo "a.out binaries are not available for this release"
  100.         exit 1
  101.         ;;
  102.         esac
  103.     fi
  104.     # Check if /dev/tty0 exists
  105.     if [ -c /dev/tty0 -o -h /dev/tty0 ]; then
  106.         : OK
  107.     else
  108.         echo ""
  109.         echo "/dev/tty0 does not exist.  The X servers need this device."
  110.         echo "Do you want me to create it for you? (y/n)"
  111.         read response
  112.         echo ""
  113.         case "$response" in
  114.         [yY]*)
  115.         (cd /dev; ./MAKEDEV tty0) >/dev/null 2>&1
  116.         if [ ! -c /dev/tty0 ]; then
  117.             (mknod /dev/tty0 c 4 0; chown root.tty /dev/tty0;
  118.              chmod 622 /dev/tty0) >/dev/null 2>&1
  119.         fi
  120.         if [ ! -c /dev/tty0 ]; then
  121.             echo "Unable to create /dev/tty0"
  122.             echo ""
  123.             echo "Try to do it manually by running either of the following commands as root:"
  124.             echo "    cd /dev; ./MAKEDEV tty0"
  125.             echo "or:"
  126.             echo "    mknod /dev/tty0 c 4 0; chown root.tty /dev/tty0; chmod 622 /dev/tty0"
  127.             NEEDSOMETHING=YES
  128.         fi
  129.         ;;
  130.         *)
  131.         echo "You will need to create the device yourself before proceeding"
  132.         NEEDSOMETHING=YES
  133.         ;;
  134.         esac
  135.     fi
  136. fi
  137.  
  138. if [ X"$NEEDSOMETHING" != X ]; then
  139.     echo ""
  140.     echo "When you've made the required updates, re-run this script"
  141.     echo "before continuing with the installation"
  142.     exit 1
  143. fi
  144.  
  145.  
  146. # If there is no previous installation, there is nothing more to do
  147.  
  148. if [ ! -d $RUNDIR/. ]; then
  149.     echo ""
  150.     echo Done
  151.     exit 0
  152. fi
  153.  
  154. echo ""
  155. echo "You are strongly advised to backup your /usr/X11R6 directory before"
  156. echo "proceeding with this installation, especially if you have customised"
  157. echo "any configuration files.  This is best done by either backing"
  158. echo "it up to tape, or making a backup copy of it.  It is not recommended"
  159. echo "that you simply rename the existing directory because you will then"
  160. echo "likely have problems finding other things that have been installed"
  161. echo "there.  If you do have such a problem, and didn't follow this advice"
  162. echo "please do not contact us about it when you find things missing."
  163. echo ""
  164. echo "This installation will overwrite existing files."
  165. echo ""
  166. echo "Do you want to continue? (y/n) "
  167. read response
  168. case "$response" in
  169.     [yY]*)
  170.         ;;
  171.     *)
  172.         echo Aborting
  173.         exit 1
  174.         ;;
  175. esac
  176.  
  177. #for i in $LIBLIST; do
  178. #    if [ -h $RUNDIR/lib/$i ]; then
  179. #        echo Removing old library link $RUNDIR/lib/$i
  180. #        rm -f $RUNDIR/lib/$i
  181. #    fi
  182. #done
  183.  
  184. for i in $OLDFILES; do
  185.     if [ -f $RUNDIR/$i ]; then
  186.         echo Removing old file $RUNDIR/$i
  187.         rm -f $RUNDIR/$i
  188.     fi
  189. done
  190.  
  191. echo ""
  192. echo Done
  193.  
  194. exit 0
  195.